<%# Copyright 2009 Swansea University

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
%>


<% title "Projects by Discipline" %>
<p><%= render(:partial => "navigation") %></p>

<% content_for :head do %>
  <script type="text/javascript">
    $(document).ready(function() {
      $('.accordian .content').hide();
      $('.accordian .head').click(function() {
        $(this).next().toggle('slow');
        return false;
      }).next().hide();
    });
  </script>
<% end %>

<p>Please note that this catergorization of projects is approximate as supervisors
may not have been particularly specific in defining the suitability of their projects
for particular disciplines. For example, mechanical engineering projects are often
suitable for product design engineering and project design technology students,
electricial and electronic engineering projects may be suitable for electronics
with computer science and telecommunication engineering.

<% if @disciplines.blank? %>
  <p>No projects to display.</p>
<% else %>
  <p>Click on a discipline to reveal the projects that have been set for that discipline.</p>

  <% @disciplines.each do |discipline| %>
    <!-- Accordian controls -->
    <div class="accordian">
      <h3  class="head" 
            id="<%= discipline.id %>"
            title="<%= discipline.id %>: <%= discipline.long_name %>">
         <%= discipline.long_name %>
      </h3>
      <div class="content">
        <table>
          <thead><td>Number</td><td>Title</td><td>Supervisor</td><td>Centre</td></thead>
          <tbody>
            <%= render(:partial => "project_index", :collection => discipline.projects) %>
          </tbody>
        </table>
        <p><%= link_to 'Back to full project list', {:action => 'index'} %></p>
        <hr />
      </div>
    </div>
  <% end %>
<% end %>